<template>
  <div class="goods">
    <h3>商品名称：{{ pname }}</h3>
    <p>商品价格：{{ price }}</p>
    <p>商品描述：{{ info }}</p>
    <button @click="$emit('kanyidao',id)">砍一刀</button>
    <button @click="$emit('zhangjia',id)">涨个价</button>
  </div>
</template>
<script>
export default {
  props:{
    id:{
      required:true, //要求必须传id值
      type:Number
    },
    pname:{
      default:'方便面'
    },
    price:Number,
    info:{
      default:'好吃好吃'
    }
  }
};
</script>
<style>
.goods {
  min-height: 100px;
  border: solid 3px black;
  padding: 10px;
  margin: 8px;
}
</style>